package com.cadre.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cadre.dao.UserMapper;
import com.cadre.entity.User;

@Service
@Transactional
public class UserServiceImpl {
	 @Autowired
	   private UserMapper usermapper;
	 

	 public boolean register(User user) {
			
			return usermapper.register(user);
		
		}
		
	

		public User login(User user) {
			
		  return this.usermapper.login(user);
		}



		public User isexit(String username) {
		return  this.usermapper.isexit(username);
		}
		
//-----------------------------------------
		//遍历全部村民
		 public List<User> SelectAllUser(){
			 return usermapper.SelectAllUser();
		 }
		 
		 	//删除村民
		 public boolean deleteUserById(Integer id){
				return usermapper.deleteUserById(id);
			}

			
		   //更新村民信息
		 public boolean UpdataUser(User user) {
			  return this.usermapper.UpdataUser(user);
			}

		 //查找更新
		public User SelectUserId(Integer id) {
			return this.usermapper.SelectUserId(id);
		}

		//村干部添加用户啊
	/*	public boolean addUser(User user){
			return this.usermapper.addUser(user);
		}*/
		
/*
 * 梁
 */
		public List<User> selectAllUser() {
			
			return this.usermapper.selectAllUser();
		}


		public boolean deleteUser(Integer id) {
			
			return this.usermapper.deleteUser(id);
		}


		public List<User> selectUser1(String name) {
			
			return this.usermapper.selectUser1(name);
		}
		/*
		 * 彭
		 */
		public User selectUserById3(Integer id) {
			return usermapper.selectUserById3(id);
		}
		
		public boolean UpdataUser3(User user) {
			boolean result = this.usermapper.UpdataUser3(user);
			return result;
		}
		
		public User selectUser(@Param("username")String username,@Param("password")String password) {
			User user = this.usermapper.selectUser(username, password);
			return user;
		}
		
		public User selectUsernameByUserid(Integer userid) {
			return this.usermapper.selectUsernameByUserid(userid);
		}
		
	

	

	
}
